/* BeerScreen, Copyright (C) 2009-2010  Gabriel Tremblay <initnull@gmail.com>
 * http://www.etrange.ca/beerscreen
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package ca.etrange.beerscreen.view;

import java.awt.Graphics;

import javax.swing.ImageIcon;
import javax.swing.JPanel;

/** Generic panel that hadle image background */
public class ImagePaintedPanel extends JPanel {
	private static final long serialVersionUID = -3961261829728280159L;
	
	private final ImageIcon backgroundImage;
	
	public ImagePaintedPanel(final String filePath){
		this.backgroundImage = new ImageIcon(filePath);
	}
	
	@Override
	public void paint(Graphics g)
	{
		// paint the image to the component graphic
		g.drawImage(backgroundImage.getImage(), 0, 0, null);
		super.paint(g);
	}
}
